home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1996 July / C-C++ Users Group Library July 1996.iso / listings / v_06_07 / v6n7018c.txt < prev    next >
Text File  |  1989-09-26  |  7KB  |  168 lines

  1.  
  2. Table 3 -- Command and Result Sequences for floppy commands
  3. -----------------------------------------------------------
  4. Byte      r/w       Read ID   Format    Recal     Seek
  5. C-0       cmd+MT    cmd+MFM   cmd+MFM   cmd       cmd
  6.            +MFM+SK
  7. C-1       HDS+DS    HDS+DS    HDS+DS    DS        HDS+DS
  8. C-2       C                   N                   NCN
  9. C-3       H                   SC
  10. C-4       R                   GPL
  11. C-5       N                   D
  12. C-6       EOT
  13. C-7       GPL
  14. C-8       DTL
  15. R-0       ST0       ST0       ST0
  16. R-1       ST1       ST1       ST1
  17. R-2       ST2       ST2       ST2
  18. R-3       C         C         C **
  19. R-4       H         H         H **
  20. R-5       R         R         R **
  21. R-6       N         N         N **
  22.  
  23. ** For format, these have no meaning.
  24.  
  25.  
  26. Table 4 -- Command and Result Sequences for FDC commands
  27. --------------------------------------------------------
  28. Byte      Specify       Sense Intr Status   Sense Drive Status
  29.  
  30. C-0       cmd           cmd                 cmd
  31. C-1       SRT+HUT                        HDS+DS
  32. C-2       HLT+ND
  33. R-0                 ST0
  34. R-1                     PCN                 ST3
  35.  
  36.  
  37. Table 5 -- What the symbols mean
  38. --------------------------------
  39. cmd - bit 0-4, command code: see table 6.  Bit 4 only set for "scan"
  40.      commands, which are not discussed here.
  41. SK - bit 5, Skip deleted address mark.  This article does not cover
  42.      deleted data.
  43. MFM - bit 6, Double Density (Modified Frequency Modulated).
  44. MT - bit 7, Multi-track.  Really should be 'multi-head'.  Allows a  read
  45.      data or read deleted data to continue at the end of track onto the
  46.      other side of floppy.  Do not use for writing.
  47. DS - bits 0 & 1, Drive select
  48. HDS - bit 2, Head select.
  49. C - Cylinder. A part of the sector ID, corresponding to (but not
  50.      necessarily equal to) the position of the track.
  51. H - Head. A part of the sector ID, corresponding to the (but not
  52.      necessarily equal to) the side of the disk.
  53. R - Record. A part of the sector ID, generally called the sector number. 
  54.      Definitely NOT the same as a CPM record.  May or may not be ordered
  55.      sequentially.
  56. N - Number of bytes code.  Defines sector size: see table 7 for value.
  57. EOT - End of Track.  The last possible sector number on the track.  Can
  58.      be larger than the number of physical sectors.
  59. GPL - Gap Length.  Used by FDC when reading or writing.
  60. FGPL - Format Gap Length.  Used by FDC in formatting.  It is a different
  61. value than the GPL used in read/write.  See Table 7 for value.
  62. DTL - Data Length.  Number of bytes in sector if N == 0.  
  63. SC - Sectors per cluster.  Format uses to know how much to write
  64. D - Data Fill byte for format command.  Initial data written to sectors.
  65. NCN - New Cylinder Number.  This is the position to "SEEK" to.
  66. HUT - bits 0-3, Head Unload time.  IBM XT specs 0xF (240 msec).
  67. SRT - bits 4-7, Step Rate time.  (16-SRT) = # millisecond.  IBM XT specs
  68.      0xC, which XT Tech Ref says is 6 ms track-to-track (I figure it to
  69.      be 4 ms).  
  70. ND - bit 0, Non-DMA mode. I don't recommend this: should remain clear.
  71. HLT - bits 1-7, Head Load Time.  2 ms increments.  XT Tech Ref specs
  72.      0x1.
  73. ST0-ST3 - Status registers ST0, ST1, ST2, and ST3.  See table 8 for
  74.      detail.
  75. PCN - Present Cylinder Number.  Where the FDC thinks the head is after a
  76.      seek or recalibrate.
  77.  
  78. Table 6 -- floppy disk command codes (except scan commands)
  79. -----------------------------------------------------------
  80. 0x00      Invalid
  81. 0x01      Invalid
  82. 0x02      Read Track (all sectors)
  83. 0x03      Specify drive parameters 
  84. 0x04      Sense drive status (get Status Reg 3)
  85. 0x05      Write Data (1 or more sectors)
  86. 0x06      Read Data (1 or more sectors)
  87. 0x07      Recalibrate drive (move head to cylinder 0)
  88. 0x08      Sense interrupt status (MUST be issued immediately after Seek 
  89.                or Recalibrate)
  90. 0x09      Write deleted data - not recommended
  91. 0x0A      Read ID fields (read ID fields off disk, wherever the head 
  92.                currently is).
  93. 0x0B      Invalid
  94. 0x0C      Read deleted data - not recommended
  95. 0x0D      Format a track (the lowest level format)
  96. 0x0E      Invalid
  97. 0X0F      Seek (move head to desired cylinder)
  98.  
  99.  
  100. Table 7 -- Values for N, GPL, and EOT for 5 1/4" floppies
  101. ---------------------------------------------------------
  102. Density   size      N         SC        GPL       FGPL
  103.  
  104. single    128       0x00      0x12      0x07      0x09
  105. single    128       0x00      0x10      0x10      0x19
  106. single    256       0x01      0x08      0x18      0x30
  107. single    512       0x02      0x04      0x46      0x87
  108. single    1024      0x03      0x02      0xC8      0xFF
  109. single    2048      0x04      0x01      0xC8      0xFF
  110.                                                   
  111. double    256       0x01      0x12      0x0A      0x0C
  112. double    256       0x01      0x10      0x20      0x32
  113. double    512       0x02      0x08      0x2A      0x50
  114. double    1024      0x03      0x04      0x80      0xF0
  115. double    2048      0x04      0x02      0xC8      0xFF
  116. double    4096      0x05      0x01      0xC8      0xFF
  117.                                                   
  118. Note:  In the IBM PC, the format is double, 512 bytes.  Despite the
  119. information in this table, nine sectors are put on the disk
  120. successfully.
  121.  
  122. Table 8 -- Status Register bit definitions
  123. ------------------------------------------
  124. Reg  bit  sym  Description
  125.  
  126. ST0  6&7  IC   Interrupt Code: 00= normal, 01= Abnormal termination,
  127.                10= Invalid command, 11= Aborted: ready signal changed.
  128.      5    SE   Seek End.
  129.      4    EC   Equiptment check. Fault signal or could not recalibrate
  130.      3    NR   Not Ready.  Normally because door not closed.
  131.      2    HD   Head Address. 0 or 1.
  132.      0&1  US   Unit (drive) select.  Only needed when doing overlapping
  133.                seeks.
  134.  
  135. ST1  7    EN   End of cylinder.  An attempt to read past the last sector
  136.                on a track.
  137.      6    n/a  (always zero)
  138.      5    DE   Data Error.  Bad data read from floppy.
  139.      4    OR   Over run.  The processor did not get data fast enough.
  140.      3    n/a  (always zero)
  141.      2    ND   No Data.  Could not read ID field requested.
  142.      1    NW   Not Writable.  Write protected floppy.
  143.      0    MA   Missing Address Mark.  Could not find ID field requested.
  144.                (This often occurs with DE with a unformatted or
  145.                corrupted disk.
  146.  
  147. ST2  7    n/a  (always zero)
  148.      6    CM   Control Mark.  A deleted sector was detected.
  149.      5    DD   Data error in Data field.  Bad data on floppy.
  150.      4    WC   Wrong Cylinder.  "C" field in command doesn't match the 
  151.                corresponding field in the ID field on disk.
  152.      3    SH   Scan Equal Hit.
  153.      2    SN   Scan not Satisfied.
  154.      1    BC   Bad Cylinder.  same as WC, but "C" == 0xFF.
  155.      0    MD   Missing Data address mark.  Could not find Data address
  156.                mark field.
  157.  
  158. ST3  7    FT   Fault.  Signal from floppy disk drive (FDD).
  159.      6    WP   Write Protected. Signal from FDD.
  160.      5    RDY  Ready. Signal from FDD.
  161.      4    T0   Track 0. Signal from FDD.
  162.      3    TS   Two Side. Signal from FDD.
  163.      2    HD   Head address.  Signal from FDD.
  164.      0&1  US   Unit select. Signals from FDD.
  165.  
  166. Note: The "sym" column is the mnemonic assigned in the Intel
  167. documentation.
  168.